package com.why.entity;

import java.util.ArrayList;
import java.util.List;

public class Index {

	String id;
	String up_id;
	String index_name;
	String unit;
	String index_order;
	String path;
	String remark;
	List<Index> children;
	
	
	public int getChildrenNum(){
		int num = 0;
		if(hasChildren()){
			List<Index> children = getChildren();
//			num = children.size();
			for(Index index:children){
				if(index.hasChildren()){
					num = num + index.getChildrenNum();
				}else{
					num++;
				}
			}
		}
		return num;
	}
	
	public boolean hasChildren(){
		if(children == null)
			return false;
		return children.size()>0;
	}
	
	public List<Index> getChildren() {
		return children;
	}
	public void setChildren(Index c) {
		if(children == null)
			children = new ArrayList<Index>();
		children.add(c);
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	public String getIndex_name() {
		return index_name;
	}
	public String getUp_id() {
		return up_id;
	}

	public void setUp_id(String up_id) {
		this.up_id = up_id;
	}

	public void setIndex_name(String index_name) {
		this.index_name = index_name;
	}
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public String getIndex_order() {
		return index_order;
	}
	public void setIndex_order(String index_order) {
		this.index_order = index_order;
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}

}
